<div class="container-fluid">
    <div class="row mt-m">
        <div class="col-md-8 col-md-offset-2">
            <alert close="closeAlert($index)" ng-repeat="alert in alerts" type="{{alert.type}}">{{alert.message}}</alert>
        </div>
    </div>

    <!-- Update Database -->
    <div class="row" ng-hide="showUserForm">
        <div class="col-md-8 col-md-offset-2">

            <div class="alert alert-warning center-block" role="alert">
                <p class="text-center">TheHive needs to update its database</p>
                <br>
                <div class="text-center">
                    <button type="button" class="btn btn-sm btn-default" ng-click="migrate()" ng-hide="migrating">Update Database</button>
                </div>
            </div>
        </div>
    </div>

    <!-- Updating Database -->
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div ng-hide="showUserForm" ng-repeat="status in migrationStatus">
                {{status.tableName}} ({{status.current}} / {{status.total}})
                <uib-progress>
                    <uib-bar type="info" value="status.current * 100 / status.total">{{status.current}}</uib-bar>
                </uib-progress>
            </div>
        </div>
    </div>

    <!-- Add Administrator account -->
    <div class="row" ng-show="showUserForm">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading"><h4>Create administrator account</h4></div>
                <div class="panel-body">
                    <form class="form-horizontal" ng-submit="createInitialUser()">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">Login</label>
                            <div class="col-sm-10">
                                <input class="form-control" ng-model="newUser.login" placeholder="Login" type="text" autocomplete="off">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">Name</label>
                            <div class="col-sm-10">
                                <input class="form-control" ng-model="newUser.name" placeholder="Name" type="text" autocomplete="off">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">Password</label>
                            <div class="col-sm-10">
                                <input class="form-control" ng-model="newUser.password" placeholder="Password" type="password" autocomplete="off">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="text-center">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button class="btn btn-primary" type="submit">Create</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
